package com.example.demo.repository;


import com.example.demo.entity.one_to_many.City;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

@Repository
public interface CityRepository extends JpaRepository<City, Integer> {


    @Query(nativeQuery = true,value = "select * from country c1  LEFT JOIN city c2 ON c2.country_country_id = c1.country_id where c1.country_id = ?1")
    List<Map<String, Object>> findInfoByCountryId(String countryId);
}
